//
//  BLMeetSiftVC.m
//  Byelone
//
//  Created by 乔小乔 on 2021/2/23.
//

#import "BLMeetSiftVC.h"
#import "BLInfoCommonCell.h"
#import "BLInfoSliderCell.h"
#import "BLInfoInputCell.h"
#import "BLBuyVipController.h"
#import "BLDestineController.h"


#define MinAge 18
#define MaxAge 40
#define MinHeight 150
#define MaxHeight 200

static NSString *reuse_BLInfoCommonCell = @"Reuse_BLInfoCommonCell";
static NSString *reuse_BLInfoSliderCell = @"Reuse_BLInfoSliderCell";
static NSString *reuse_BLInfoInputCell = @"Reuse_BLInfoInputCell";
@interface BLMeetSiftVC ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableViewList;
@property (weak, nonatomic) IBOutlet UIView *viewTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutTop;
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (strong, nonatomic) IBOutlet UIView *viewTest;
@property (strong, nonatomic) IBOutlet UIView *viewVip;
@property (nonatomic, copy) NSArray *arrayData;
@property (weak, nonatomic) IBOutlet UIButton *btnVip;
@property (weak, nonatomic) IBOutlet UIButton *btnTest1;
@property (weak, nonatomic) IBOutlet UIButton *btnTest2;
@property (nonatomic, strong) BLInfoConfigModel *configModel;

@property (nonatomic, strong) NSString *strIndustry;
@property (nonatomic, strong) NSString *strArea;
@property (nonatomic, strong) NSString *strHomeTown;
@property (nonatomic, strong) NSString *strAge;
@property (nonatomic, strong) NSString *strHeight;

@property (nonatomic, strong) UITextField *textField;
@end

@implementation BLMeetSiftVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"筛选";
    [self getCommonMap];
//    type--1:slider，2选择，3输入，4开关
    self.arrayData = @[@[@{@"title":@"年龄",@"type":@"1"},@{@"title":@"身高",@"type":@"1"},@{@"title":@"婚姻状态",@"type":@"2"},@{@"title":@"所在地",@"type":@"2"}],@[@{@"title":@"家乡",@"type":@"2"},@{@"title":@"年收入范围",@"type":@"2"},@{@"title":@"学历",@"type":@"2"},@{@"title":@"毕业院校",@"type":@"3"},@{@"title":@"从事行业",@"type":@"2"},@{@"title":@"活跃度标签",@"type":@"4"},@{@"title":@"高信用标签",@"type":@"4"},@{@"title":@"高魅力标签",@"type":@"4"},@{@"title":@"vip",@"type":@"4"}]];
    [self createUI];
}

-(void)getCommonMap{
    BOOL isEdit = YES;
    if (!_siftInfo) {
        isEdit = NO;
    }
    [BLHttpTool getHttpRequest:BL_COMMON_CONFIG param:@{} finish:^(NSURLSessionDataTask * _Nonnull data, NSDictionary * _Nonnull obj) {
        if (obj) {
            if ([[obj objectForKey:@"code"] integerValue] == 1) {
                NSDictionary * dic = [obj objectForKey:@"content"];
                self.configModel = [BLInfoConfigModel mj_objectWithKeyValues:dic];
                if (isEdit) {
                    [self.tableViewList reloadData];
                }
            }
        }
    } failedBlock:^(id  _Nonnull data, NSError * _Nonnull error) {
        
    }];
}
- (IBAction)clickVip:(id)sender {
    
    BLBuyVipController * buy = [[BLBuyVipController alloc]init];
//    BLDestineController * buy = [[BLDestineController alloc]init];
    [self.navigationController pushViewController:buy animated:YES];
    
}
- (IBAction)clickTest:(UIButton *)sender {
//    101，102
    sender.selected = !sender.selected;
    if (sender.tag == 101) {
        self.siftInfo.personalityTest = sender.selected?@(1):@(0);
    }else{
        self.siftInfo.expectationTest = sender.selected?@(1):@(0);
    }
    [self changeSift];
}
- (void)createUI{
    //    导航栏又按钮
    UIButton *btnRight = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnRight setTitle:@"重置" forState:UIControlStateNormal];
    btnRight.titleLabel.font = [UIFont systemFontOfSize:16];
    [btnRight setTitleColor:[UIColor chColorWithHexString:@"#6C72F5"] forState:UIControlStateNormal];
    [btnRight addTarget:self action:@selector(clickRightBar) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:btnRight];
    self.navigationItem.rightBarButtonItem = item;
    
    if (@available(iOS 11.0, *)) {
        self.tableViewList.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else{
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    [self.tableViewList registerNib:[UINib nibWithNibName:@"BLInfoCommonCell" bundle:nil] forCellReuseIdentifier:reuse_BLInfoCommonCell];
    [self.tableViewList registerNib:[UINib nibWithNibName:@"BLInfoSliderCell" bundle:nil] forCellReuseIdentifier:reuse_BLInfoSliderCell];
    [self.tableViewList registerNib:[UINib nibWithNibName:@"BLInfoInputCell" bundle:nil] forCellReuseIdentifier:reuse_BLInfoInputCell];
    
    self.viewTop.layer.cornerRadius = 5;
    self.viewTop.layer.masksToBounds = YES;

    [self.btnTest1 setAttributedTitle:[self getAttStrWithBase:@"使用《性格测试》结果检索" string:@"《性格测试》"] forState:UIControlStateNormal];
    [self.btnTest2 setAttributedTitle:[self getAttStrWithBase:@"使用《我的期望》结果检索" string:@"《我的期望》"] forState:UIControlStateNormal];
    [self changeSift];
}
//按钮的设置
- (NSMutableAttributedString *)getAttStrWithBase:(NSString *)baseStr string:(NSString *)string{
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:baseStr];
    [attr addAttributes:@{NSForegroundColorAttributeName:[UIColor chColorWithHexString:@"#6D72F6"]} range:NSMakeRange(2, string.length)];
    return attr;
}
- (void)clickRightBar{
    _siftInfo = nil;
    self.strIndustry = nil;
    self.strArea = nil;
    self.strHomeTown = nil;
    self.strAge = nil;
    self.strHeight = nil;
    [self.tableViewList reloadData];
    [self changeSift];
}

- (void)clickSubmit{
    NSDictionary *dict = @{};
    NSDictionary *dictStr = @{@"strIndustry":self.strIndustry?:@"",@"strArea":self.strArea?:@"",@"strHomeTown":self.strHomeTown?:@"",@"strAge":self.strAge?:@"",@"strHeight":self.strHeight?:@""};
    if (_siftInfo) {
        dict = [self.siftInfo mj_keyValues];
    }
    if (self.myBlock) {
        self.myBlock(dict,dictStr);
        [self.navigationController popViewControllerAnimated:YES];
    }
}
- (void)changeSift{
    NSMutableString *strTip = [[NSMutableString alloc]init];
    if (![NSString blIsBlankString:self.strAge]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.strAge]];
    }
    if (![NSString blIsBlankString:self.strHeight]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.strHeight]];
    }
    if (![NSString blIsBlankString:self.siftInfo.marryStr]) {
        NSString *Id = self.siftInfo.marryStr;
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.configModel.marryMap[Id]]];
    }
    if (![NSString blIsBlankString:self.strArea]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.strArea]];
    }
    if (self.siftInfo.personalityTest.integerValue==1) {
        [strTip appendString:@"性格测试;"];
    }
    if (self.siftInfo.expectationTest.integerValue==1) {
        [strTip appendString:@"我的期望;"];
    }
    if (![NSString blIsBlankString:self.strHomeTown]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.strHomeTown]];
    }
    if (self.siftInfo.yearIncome>0) {
        NSString *Id = [NSString stringWithFormat:@"%@",self.siftInfo.yearIncome];
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.configModel.incomeMap[Id]]];
    }
    if (self.siftInfo.grade>0) {
        NSString *Id = [NSString stringWithFormat:@"%@",self.siftInfo.grade];
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.configModel.gradeMap[Id]]];
    }
    if (![NSString blIsBlankString:self.siftInfo.school]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.siftInfo.school]];
    }
    if (![NSString blIsBlankString:self.strIndustry]) {
        [strTip appendFormat:@"%@", [NSString stringWithFormat:@"%@;",self.strIndustry]];
    }
    if (self.siftInfo.active.integerValue == 1) {
        [strTip appendString:@"活跃度;"];
    }
    if (self.siftInfo.highCredit.integerValue == 1) {
        [strTip appendString:@"高信用;"];
    }
    if (self.siftInfo.highCharm.integerValue == 1) {
        [strTip appendString:@"高魅力;"];
    }
    if (self.siftInfo.vip.integerValue == 1) {
        [strTip appendString:@"vip;"];
    }
    if (![NSString blIsBlankString:strTip]) {
         self.labelTitle.text = [NSString stringWithFormat:@"已选条件:%@",strTip];
        self.layoutTop.constant = 20;
        self.viewTop.hidden = NO;
    }else{
        self.layoutTop.constant = 0;
        self.viewTop.hidden = YES;
    }
   
}

- (void)setCorner:(UIView *)view size:(CGSize)size rect:(UIRectCorner)rectCorner withHeight:(CGFloat)height{
    CGRect frame = CGRectMake(0, 0, BL_WINDOW_WIDTH-20, height);
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: frame byRoundingCorners:rectCorner cornerRadii:size];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = frame;
    //赋值
    maskLayer.path = maskPath.CGPath;
    
    view.layer.mask = maskLayer;
}
//根据类型标题处理数组
- (NSArray *)getAlertArray:(NSString *)title{
    NSMutableArray *alertArray = [NSMutableArray new];
    NSDictionary *dict;
    if ([title isEqualToString:@"婚姻状态"]) {
        dict = self.configModel.marryMap;
    }else if ([title isEqualToString:@"学历"]){
        dict = self.configModel.gradeMap;
    }else if ([title isEqualToString:@"年收入范围"]){
        dict = self.configModel.incomeMap;
    }
    NSMutableArray *arrayKeys = [NSMutableArray arrayWithArray:dict.allKeys];
//    NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"key" ascending:YES];
//    [arrayKeys sortUsingDescriptors:[NSArray arrayWithObject:sort]];
    for (NSString *keys in arrayKeys) {
        BLCommon_Model_AlertItem *item = [[BLCommon_Model_AlertItem alloc]init];
        item.text = dict[keys];
        item.Id = keys;
        [alertArray addObject:item];
    }
    return alertArray;
}
- (void)disposeSelectData:(NSString *)title item:(BLCommon_Model_AlertItem *)item{
    if ([title isEqualToString:@"婚姻状态"]) {
        self.siftInfo.marryStr = item.Id;
    }else if ([title isEqualToString:@"学历"]){
        self.siftInfo.grade = @(item.Id.integerValue);
    }else if ([title isEqualToString:@"年收入范围"]){
        self.siftInfo.yearIncome = @(item.Id.integerValue);
    }
}
- (void)textFieldWithText:(UITextField *)textField{
    self.siftInfo.school = textField.text;
    [self changeSift];
}
#pragma mark - delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.arrayData.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSArray *array = self.arrayData[section];
    return array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *array = self.arrayData[indexPath.section];
    NSDictionary *dict = array[indexPath.row];
    NSString *strTitle = dict[@"title"];
    NSString *type = dict[@"type"];
    UIRectCorner rectCorner= UIRectCornerTopLeft|UIRectCornerTopRight;
    CGSize rect = CGSizeMake(5, 5);
    if (indexPath.row == 0) {
        rectCorner = UIRectCornerTopLeft|UIRectCornerTopRight;
        if (indexPath.row == array.count-1) {
            rectCorner = UIRectCornerAllCorners;
        }
    }else if (indexPath.row == array.count-1) {
        rectCorner = UIRectCornerBottomLeft|UIRectCornerBottomRight;
    }else{
        rect = CGSizeMake(0, 0);
    }
    
    if (type.intValue == 1) {
        BLInfoSliderCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse_BLInfoSliderCell forIndexPath:indexPath];
        if ([strTitle isEqualToString:@"年龄"]) {
            NSInteger min = MinAge;
            NSInteger max = MaxAge;
            if (![NSString blIsBlankString:self.strAge]) {
                NSArray *array = [self.strAge componentsSeparatedByString:@","];
                NSString *str1 = array[0];
                NSString *str2 = array[1];
                min = str1.integerValue;
                max = str2.integerValue;
            }
            [cell reloadWithModel:strTitle min:MinAge max:MaxAge curMin:min curMax:max unit:@"岁"];
        }else if ([strTitle isEqualToString:@"身高"]) {
            NSInteger min = MinHeight;
            NSInteger max = MaxHeight;
            if (![NSString blIsBlankString:self.strHeight]) {
                NSArray *array = [self.strHeight componentsSeparatedByString:@","];
                NSString *str1 = array[0];
                NSString *str2 = array[1];
                min = str1.integerValue;
                max = str2.integerValue;
            }
            [cell reloadWithModel:strTitle min:MinHeight max:MaxHeight curMin:min curMax:max unit:@""];
        }
        [self setCorner:cell.viewBj size:rect rect:rectCorner withHeight:60];
        cell.myBlock = ^(NSString *min, NSString *max) {
            if ([strTitle isEqualToString:@"年龄"]) {
                if (min.integerValue == MinAge && max.integerValue == MaxAge) {
                    self.strAge = nil;
                }else{
                    self.strAge = [NSString stringWithFormat:@"%@,%@",min,max];
                }
                self.siftInfo.ageStr = self.strAge;
            }else if ([strTitle isEqualToString:@"身高"]) {
                if (min.integerValue == MinHeight && max.integerValue == MaxHeight) {
                    self.strHeight = nil;
                }else{
                    self.strHeight = [NSString stringWithFormat:@"%@,%@",min,max];
                }
                self.siftInfo.heightStr = self.strHeight;
            }
            [self changeSift];
        };
        return cell;
    }else if(type.intValue == 2||type.intValue == 4){
        BLInfoCommonCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse_BLInfoCommonCell forIndexPath:indexPath];
        
        cell.labelTitle.text = strTitle;
        if (type.intValue == 2) {
            cell.btnEnter.hidden = NO;
            cell.mySwitch.hidden = YES;
            cell.textFieldContent.placeholder = [NSString stringWithFormat:@"请选择%@",strTitle];
            if ([strTitle isEqualToString:@"婚姻状态"]) {
                NSString *Id = self.siftInfo.marryStr;
                cell.textFieldContent.text = Id?self.configModel.marryMap[Id]:@"";
            }else if ([strTitle isEqualToString:@"所在地"]) {
                cell.textFieldContent.text = self.strArea;
            }else if ([strTitle isEqualToString:@"家乡"]) {
                cell.textFieldContent.text = self.strHomeTown;
            }else if ([strTitle isEqualToString:@"年收入范围"]) {
                NSString *Id = [NSString stringWithFormat:@"%@",self.siftInfo.yearIncome];
                cell.textFieldContent.text = Id?self.configModel.incomeMap[Id]:@"";
            }else if ([strTitle isEqualToString:@"学历"]) {
                NSString *Id = [NSString stringWithFormat:@"%@",self.siftInfo.grade];
                cell.textFieldContent.text = Id?self.configModel.gradeMap[Id]:@"";
            }else if ([strTitle isEqualToString:@"从事行业"]) {
                cell.textFieldContent.text = self.strIndustry;
            }
        }else{
            cell.btnEnter.hidden = YES;
            cell.mySwitch.hidden = NO;
            cell.textFieldContent.placeholder = @"";
            if ([strTitle isEqualToString:@"活跃度标签"]) {
                cell.mySwitch.on = self.siftInfo.active.integerValue==1?YES:NO;
            }else if([strTitle isEqualToString:@"高信用标签"]) {
                cell.mySwitch.on = self.siftInfo.highCredit.integerValue==1?YES:NO;
            }else if([strTitle isEqualToString:@"高魅力标签"]) {
                cell.mySwitch.on = self.siftInfo.highCharm.integerValue==1?YES:NO;
            }else if([strTitle isEqualToString:@"vip"]) {
                cell.mySwitch.on = self.siftInfo.vip.integerValue==1?YES:NO;
            }
            cell.mySwitch.userInteractionEnabled = [BLUserManager shareUser].userInfo.vip;

            cell.myBlock = ^(BOOL isOpen) {
                if ([strTitle isEqualToString:@"活跃度标签"]) {
                    self.siftInfo.active=isOpen?@(1):@(0);
                }else if([strTitle isEqualToString:@"高信用标签"]) {
                    self.siftInfo.highCredit=isOpen?@(1):@(0);
                }else if([strTitle isEqualToString:@"高魅力标签"]) {
                    self.siftInfo.highCharm=isOpen?@(1):@(0);
                }else if([strTitle isEqualToString:@"vip"]) {
                    self.siftInfo.vip=isOpen?@(1):@(0);
                }
                [self changeSift];
            };
        }
        [self setCorner:cell.viewBj size:rect rect:rectCorner withHeight:48];
        return cell;
    }else {
        BLInfoInputCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse_BLInfoInputCell forIndexPath:indexPath];
        cell.labelTag.hidden = YES;
        cell.labelTitle.text = strTitle;
        cell.textFieldContent.placeholder = [NSString stringWithFormat:@"请输入%@",strTitle];
        cell.textFieldContent.text = _siftInfo.school;
        [cell.textFieldContent addTarget:self action:@selector(textFieldWithText:) forControlEvents:UIControlEventEditingChanged];
        self.textField = cell.textFieldContent;
        [self setCorner:cell.viewBj size:rect rect:rectCorner withHeight:48];
        cell.textFieldContent.userInteractionEnabled = [BLUserManager shareUser].userInfo.vip;
        
        return cell;
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *array = self.arrayData[indexPath.section];
    NSDictionary *dict = array[indexPath.row];
    NSString *type = dict[@"type"];
    if (type.intValue == 1) {
        return 60;
    }
    return 48;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        return 12;
    }
    return 45;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (section==0) {
        return 78;
    }
    return 85;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = [UIColor whiteColor];
    if (section==1) {
        return self.viewVip;
    }
    return view;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = [UIColor whiteColor];
    if (section == 0) {
        self.btnTest1.selected = _siftInfo.personalityTest.integerValue==1?YES:NO;
        self.btnTest2.selected = _siftInfo.expectationTest.integerValue==1?YES:NO;
        return self.viewTest;
    }else{
        UIButton *btnToTest = [UIButton buttonWithType:UIButtonTypeCustom];
        btnToTest.frame = CGRectMake(28, 30, BL_WINDOW_WIDTH-56, 46);
        [btnToTest setGradientBackgroundWithColors:@[[UIColor chColorWithHexString:@"#8680FC"],[UIColor chColorWithHexString:@"#6C72F5"]] locations:@[@(0.0f), @(1.0f)]  startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
        [btnToTest setTitle:@"确认筛选" forState:UIControlStateNormal];
        btnToTest.titleLabel.font = [UIFont systemFontOfSize:16];
        [btnToTest setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [btnToTest addTarget:self action:@selector(clickSubmit) forControlEvents:UIControlEventTouchUpInside];
        btnToTest.layer.cornerRadius = 23;
        btnToTest.layer.masksToBounds = YES;
        [view addSubview:btnToTest];
    }
    return view;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.textField.isFirstResponder) {
        [self.textField resignFirstResponder];
    }
    
    if (indexPath.section == 1&&![BLUserManager shareUser].userInfo.vip) {
        [[BLHUD shareHud]showtip:@"开通VIP才能使用高级筛选功能"];
        return;
    }
    
    NSArray *array = self.arrayData[indexPath.section];
    NSDictionary *dict = array[indexPath.row];
    NSString *type = dict[@"type"];
    NSString *strTitle = dict[@"title"];
    if (type.intValue==2) {
        BLInfoCommonCell *cell = [tableView cellForRowAtIndexPath:indexPath];

        if ([strTitle isEqualToString:@"婚姻状态"]||[strTitle isEqualToString:@"学历"]||[strTitle isEqualToString:@"年收入范围"]) {
            NSArray *arrayItem = [self getAlertArray:strTitle];
            
            if (arrayItem.count>0) {
                [BLPickManager showRoomPickView:strTitle array:arrayItem select:^(BLCommon_Model_AlertItem * _Nonnull dateDic) {
                    cell.textFieldContent.text = dateDic.text;
                    [self disposeSelectData:strTitle item:dateDic];
                    [self changeSift];
                }];
            }
        }else if ([strTitle isEqualToString:@"从事行业"]) {
            NSMutableArray *alertArray = [NSMutableArray new];
                for (BLInfoIndustryItem *indusItem in self.configModel.industryList) {
                    BLCommon_Model_AlertItem *item = [[BLCommon_Model_AlertItem alloc]init];
                    item.text = indusItem.name;
                    item.Id = indusItem.Id;
                    [alertArray addObject:item];
                }
            if (alertArray.count>0) {
                [BLPickManager showRoomPickView:strTitle array:alertArray select:^(BLCommon_Model_AlertItem * _Nonnull dateDic) {
                    cell.textFieldContent.text = dateDic.text;
                    if ([strTitle isEqualToString:@"从事行业"]) {
                        if (self.siftInfo.industry.integerValue!=dateDic.Id.integerValue) {
                            self.siftInfo.industry = @(dateDic.Id.integerValue);
                            self.strIndustry = dateDic.text;
                        }
                        [self changeSift];
                    }
                }];
            }
        }else{
            if ([strTitle isEqualToString:@"所在地"]||[strTitle isEqualToString:@"家乡"]) {
                [BLPickManager showAreaPickView:^(NSDictionary * _Nonnull dic) {
                    NSString *str = [NSString stringWithFormat:@"%@ %@",dic[@"area"][@"name"],dic[@"city"][@"name"]];
                    cell.textFieldContent.text = str;
                    if([strTitle isEqualToString:@"所在地"]){
                        self.strArea = str;
                        self.siftInfo.livingAreaId = @([NSString stringWithFormat:@"%@",dic[@"area"][@"id"]].integerValue);
                        self.siftInfo.livingCityId = @([NSString stringWithFormat:@"%@",dic[@"city"][@"id"]].integerValue);
                    }else{
                        self.strHomeTown = str;
                        self.siftInfo.homeAreaId = @([NSString stringWithFormat:@"%@",dic[@"area"][@"id"]].integerValue);
                        self.siftInfo.homeCityId = @([NSString stringWithFormat:@"%@",dic[@"city"][@"id"]].integerValue);
                    }
                    [self changeSift];
                }];
            }
        }
    }
}
#pragma mark -
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    if (self.textField.isFirstResponder) {
        [self.textField resignFirstResponder];
    }
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    if (self.textField.isFirstResponder) {
        [self.textField resignFirstResponder];
    }
}

#pragma mark - get
- (BLMeetSiftInfo *)siftInfo{
    if (!_siftInfo) {
        _siftInfo = [[BLMeetSiftInfo alloc]init];
    }
    return _siftInfo;
}
- (void)setSearchStrDic:(NSDictionary *)searchStrDic{
    _searchStrDic = searchStrDic;
    self.strIndustry = searchStrDic[@"strIndustry"];
    self.strArea = searchStrDic[@"strArea"];
    self.strHomeTown = searchStrDic[@"strHomeTown"];
    self.strAge = searchStrDic[@"strAge"];
    self.strHeight = searchStrDic[@"strHeight"];
    [self changeSift];
    [self.tableViewList reloadData];
}
@end
